<template>
  <div class="header">
    <h3 class="top" @click='$emit("goReceiving")'>{{ addressList[carIndex] && addressList[carIndex].address || '暂无地址' }}</h3>
    <van-sticky>
      <div class="button">
        <div class="content" @click="$router.push('/search')">搜索饿了么商家、商品名称</div>
      </div>
    </van-sticky>
  </div>
</template>

<script>
export default {
  name: 'Header',
  props: {
    addressList: {
      type: Array,
      required: true,
    },
    carIndex: [String, Number]
  }
}
</script>

<style lang='scss' scoped>
.header {
  width: 100%;
  padding: 0 5%;
  box-sizing: border-box;
  background-image: linear-gradient(90deg,#0af,#0085ff);
  .top {
    height: 50px;
    line-height: 55px;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 45%;
  }
  .button {
    height: 50px;
    .content {
      width: 100%;
      height: 40px;
      border: solid 1px #ccc;
      border-radius: 6px;
      text-align: center;
      line-height: 40px;
      color: #ccc;
      background: #fff;
    }
  }
}
</style>
